<%@ taglib prefix="t" tagdir="/WEB-INF/tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<t:wrapper>
	<jsp:attribute name="title">
		<spring:message code="chapter.home.title" arguments="${chapter.title},${chapter.course.name}"/>
	</jsp:attribute>
	<jsp:body>
		<h2>${chapter.title}</h2>
		<p>${chapter.content}
		<div>
			<c:if test="${doAssignmentsExist}">
				<button onclick="location.href='<c:url value="/assignment/download/${chapter.course.id}/${chapter.id}"/>'">
					<spring:message code="chapter.home.download"/>
				</button>
			</c:if>
			<c:choose>
				<c:when test="${chapter.progressTest != null}">
					<button onclick="location.href='<c:url value="/progress_test/do_test/${chapter.progressTest.id}/"/>'">
						<spring:message code="progresstest.link.do"/>
					</button>
				</c:when>
			</c:choose>
			<c:if test="${isTeacher}">
				<button onclick="location.href='<c:url value="/progress_test/${chapter.course.id}/${chapter.id}/create"/>'">
					<spring:message code="progresstest.title"/>
				</button>		 
			</c:if>
		</div>
	</jsp:body>
</t:wrapper>